package com.bwie.user.service.impl;

import com.bwie.common.domain.User;
import com.bwie.user.mapper.UserMapper;
import com.bwie.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @ClassName: UserServiceImpl
 * @Description:
 * @Author: ZengFz
 * @Date: 2024/5/17 9:20:32
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserByTel(String tel) {
        return userMapper.findUserByTel(tel);
    }

//    @Override
//    @Transactional
//    public void register(User user) {
//        //后台校验手机号不能为空(前台校验其他字段)
//        if (user.getUserId() == null || user.getTel().equals("")){
//            throw new RuntimeException("手机号不能为空，请输入");
//        }
//        User userByTel = userMapper.findUserByTel(user.getTel());
//        if (userByTel != null){
//            throw new RuntimeException("用户已存在，请登录");
//        }
//        userMapper.register(user);
//    }

}
